package com.wans.guli.order.feign;

import com.wans.guli.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@FeignClient(value = "guli-ware", path = "/guli-ware")
public interface WareFeignClient {

    /**
     * 根据sku批量查询库存状态
     */
    @GetMapping("/ware/waresku/stock/skuIds")
    R stockBySkuIds(@RequestParam("skuIds") List<Long> skuIds);

    /**
     * 模拟用户邮费
     *
     * @param addrId 收货地址id
     * @return 运费
     */
    @GetMapping(value = "/ware/wareinfo/fare")
    R getFare(@RequestParam("addrId") Long addrId);

    /**
     * 根据sku批量扣减库存
     */
    @PostMapping("/ware/waresku/stockSub/skuIds")
    R stockBySkuIdsSubStock(@RequestBody Map<Long, Long> skuIdAndNum);
}
